import { useState, useEffect } from 'react';
export const useHeight = (ref) => {
  const [height, setHeight] = useState(0);
  const handleResize = () => {
    if (ref.current) {
      setHeight(ref.current.clientHeight);
    }
  }
  useEffect(() => {
    handleResize();
    window.addEventListener('resize', handleResize);
    return () => {
      window.removeEventListener('resize', handleResize);
    }
  }, [])
  return { height };
}